package com.link.base.base.duty.service;

import com.link.base.base.user.model.User;
import com.link.base.base.common.model.InterObject;
import com.link.base.base.common.model.Menu;
import com.link.base.base.common.model.MenuTree;
import com.link.base.base.duty.model.Duty;
import com.link.base.base.duty.model.DutyDto;
import com.link.base.base.duty.model.DutyMenu;
import com.link.base.base.urlinfo.model.UrlInfo;
import com.link.core.basic.service.BasicService;

import java.util.List;
import java.util.Map;

/**
 * Copyright  hande Company. All Rights Reserved.
 * 职责管理
 *
 * @author  unknwon
 * @date:   2018/11/9 16:57
 * @version 1.0
 */
public interface DutyService extends BasicService<Duty> {

    /**
     * 查询菜单列表：查询职责关联的菜单
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<Menu> queryDutyOfMenuListPage(Menu record) throws Exception;

    /**
     * 查询职责列表，分页查询菜单关联的职责
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<Duty> queryDutyListOfMenu(Menu record) throws Exception;

    /**
     * 查询职责列表，如果是000账套，则去除cropid限制
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<Duty> queryDutyListPage(Duty record) throws Exception;

    /**
     * 查询用户列表：查询职责关联的用户
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<User> queryDutyOfUserListPage(User record) throws Exception;

    /**
     * 查询菜单列表：查询未关联职责的菜单
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<Menu> queryUnSelectMenuListPage(Menu record) throws Exception;

    /**
     * 查询安全性菜单列表：为关联职责菜单
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<Menu> queryUnSelectSubMenuListPage(Menu record) throws Exception;

    /**
     * 查询未被 当前二级菜单关联的 职责列表
     *
     * @author zhangyuhao
     * @time 2019-2-18 11:10:58
     * @param record
     * @return
     * @throws Exception
     */
    public List<Duty> queryunSelectDutyOfMenuPage(Duty record) throws Exception;

    public List<User> queryUnSelectUserListPage(User record) throws Exception;

    /**
     * <p>查询未选中关联职责的url信息</p>
     *
     * @author yrf
     * @param record
     * @return
     * @throws Exception
     */
    public List<UrlInfo> queryUnSelectUrlListPage(UrlInfo record) throws Exception;

    /**
     * 查询未被当前url关联的职责列表
     *
     * @author yaojiangyi
     * @date 2019/02/28 16:53
     * @param record 职责
     */
    public List<Duty> queryunSelectDutyOfUrlPage(Duty record) throws Exception;

    /**
     * 添加菜单：给职责添加菜单
     *
     * @param record
     * @throws Exception
     */
    public void addMenuOfDutyInsert(Menu record) throws Exception;

    /**
     * 添加用户：给职责添加用户
     *
     * @param record
     * @throws Exception
     */
    public void addUserOfDutyInsert(User record) throws Exception;

    /**
     * 删除菜单：删除职责下的菜单
     *
     * @param record
     * @throws Exception
     */
    public void delMenuOfDuty(InterObject record) throws Exception;

    /**
     * 删除用户：删除职责下的用户
     *
     * @param record
     * @throws Exception
     */
    public void delUserOfDuty(InterObject record) throws Exception;

    /**
     * <p>修改职责下的菜单</p>
     *
     * @author yrf
     * @param record
     * @return
     * @throws Exception
     */
    public int menuOfDutyUpdate(Menu record) throws Exception;

    /**
     * <p>查询职责对应的菜单并将其构建为属性结构</p>
     *
     * @author czy
     * @param record
     * @return
     * @throws Exception
     */
    public Map<String, Object> menuTreeOfDuty(Menu record) throws Exception;

    /**
     * 通过dutyId查找菜单
     * @param record
     * @return
     * @throws Exception
     */
    public List<Menu> queryMenuByDutyId(Menu record) throws Exception;

    /**
     * 给当前职责添加菜单及安全性菜单
     * 先删除当前职责下的所有菜单及安全性菜单
     *
     * @param record
     * @throws Exception
     */
    public void addMenuAndSubMenuOfDuty(DutyMenu record) throws Exception;

    /**
     * 删除职责：删除用户下的职责
     *
     * @param record
     * @throws Exception
     */
    public void delDutyByUserId(InterObject record) throws Exception;

    /**
     * 快速设置职责的菜单安全性
     *
     * @author yangxiaolin
     * @date 2019/03/07 14:29
     * @param entity 更新前数据和更新后数据
     */
    public void saveQuickSafetyMenuDuty(MenuTree entity) throws Exception;

    /**
     * 获取用户所有职责？
     *
     * @author unknown
     * @date 2019/12/12 14:29
     */
    List<DutyDto> queryUsersDutyListPage(DutyDto t) throws Exception;

    /**
     * 刷新用户所有职责权限
     *
     * @author 黄龙建
     * @date 2020年07月03日
     */
    public void refreshPermissions() throws Exception;

    /**
     * 刷新用户有一个职责的权限
     *
     * @author 黄龙建
     * @date 2020年07月03日
     */
    public void refreshPermByDutyId(Duty duty) throws Exception;

    public void refreshPermissionsNew() throws Exception;
}
